# HTML DOM Table Object

« Previous
Next Reference »

## Table Object

The Table object represents an HTML <table> element.

### Access a Table Object

You can access a <table> element by using getElementById():

var x = document.getElementById("myTable"); Try it

### Create a Table Object

You can create a <table> element by using the document.createElement() method:

var x = document.createElement("TABLE"); Try it

## Table Object Collections

Collection | Description
--- | ---
rows | Returns a collection of all <tr> elements in a table
tBodies | Returns a collection of all <tbody> elements in a table

## Table Object Properties

Property | Description
--- | ---
align | Not supported in HTML5. Use style.cssFloat instead. Sets or returns the alignment of a table according to surrounding text
background | Not supported in HTML5. Use style.background instead. Sets or returns the background image of a table
bgColor | Not supported in HTML5. Use style.backgroundColor instead. Sets or returns the background color of a table
border | Deprecated. Use style.border instead. Sets or returns the width of the table border.
caption | Returns the <caption> element of a table
cellPadding | Not supported in HTML5. Use style.padding instead. Sets or returns the amount of space between the cell border and cell content
cellSpacing | Not supported in HTML5. Use style.borderSpacing instead. Sets or returns the amount of space between the cells in a table
frame | Not supported in HTML5. Sets or returns which outer-borders (of a table) that should be displayed
height | Not supported in HTML5. Use style.height instead. Sets or returns the height of a table
rules | Not supported in HTML5. Sets or returns which inner-borders (between the cells) that should be displayed in a table
summary | Not supported in HTML5. Sets or returns a description of the data in a table
tFoot | Returns a reference to the <tfoot> element of a table
tHead | Returns a reference to the <thead> element of a table
width | Not supported in HTML5. Use style.width instead. Sets or returns the width of the table

## Table Object Methods

Method | Description
--- | ---
createCaption() | Creates an empty <caption> element and adds it to the table
createTFoot() | Creates an empty <tfoot> element and adds it to the table
createTHead() | Creates an empty <thead> element and adds it to the table
deleteCaption() | Removes the first <caption> element from the table
deleteRow() | Removes a row (<tr>) from the table
deleteTFoot() | Removes the <tfoot> element from the table
deleteTHead() | Removes the <thead> element from the table
insertRow() | Creates an empty <tr> element and adds it to the table

## Standard Properties and Events

The Table object also supports the standard properties and events.

## Related Pages

HTML tutorial: HTML Tables

HTML reference: HTML <table> tag

« Previous
Next Reference »

### WEB HOSTING

UK Reseller Hosting

### WEB BUILDING

FREE Website BUILDER Free HTML5 Templates

### W3SCHOOLS EXAMS

HTML, CSS, JavaScript, PHP, jQuery, XML, and ASP Certifications

### SHARE THIS PAGE

### Color Picker

### HTML/CSS

HTML Tutorial HTML5 Tutorial CSS Tutorial CSS3 Tutorial Bootstrap Tutorial

### JavaScript

JavaScript Tutorial jQuery Tutorial jQuery Mobile Tutorial AngularJS Tutorial AJAX Tutorial JSON Tutorial

### Graphics

Canvas Tutorial SVG Tutorial Google Maps Tutorial

### Server Side

SQL Tutorial PHP Tutorial ASP Tutorial ASP.NET Tutorial VBScript Tutorial AppML Tutorial

### Web

Web Building Web Statistics Web Certification

### XML

XML Tutorial DTD Tutorial Schema Tutorial XML DOM Tutorial XPath Tutorial XSLT Tutorial XQuery Tutorial XSL-FO Tutorial RSS Tutorial WSDL Tutorial

### HTML/CSS

HTML Tag Reference HTML Event Reference HTML Color Reference CSS 1,2,3 Reference Bootstrap Reference

### JavaScript

JavaScript Reference HTML DOM Reference jQuery Reference jQuery Mobile Reference Google Maps Reference

### Server Side

PHP Reference SQL Reference ASP Reference VBScript Reference Razor Reference ASP.NET Reference

### XML

XML DOM Reference XSLT Reference XSL-FO Reference XPath Reference XQuery Reference Schema Reference RSS Reference SVG Reference

### HTML Charsets

HTML Character Sets HTML ASCII HTML ANSI HTML Windows-1252 HTML ISO-8859-1 HTML Symbols HTML UTF-8

### HTML/CSS

HTML Examples CSS Examples

### Browser Scripting

JavaScript Examples HTML DOM Examples jQuery Examples jQuery Mobile Examples AngularJS Examples AJAX Examples

### Server Scripting

PHP Examples ASP Examples VBScript Examples Razor Examples .NET Examples

### XML Languages

XML Examples DTD Examples XML DOM Examples XSL Examples XSLT Examples XPath Examples XQuery Examples Schema Examples RSS Examples SVG Examples